package javasea.orm.mybatisplus.dynamicDS.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import javasea.orm.mybatisplus.dynamicDS.entity.PageInfo;
import javasea.orm.mybatisplus.dynamicDS.entity.User;
import javasea.orm.mybatisplus.dynamicDS.mapper.UserMapper;
import javasea.orm.mybatisplus.dynamicDS.service.UserService;
import lombok.AllArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
//@DS("slave_1")
@AllArgsConstructor
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {

    @Autowired
    UserMapper userMapper;

    //查所有
    @Override
//    @DS("slave_1")
    public List<User> selectAll() {
        List<User> users = userMapper.selectList(null);
        return users;
    }

    @Override
    @DS("slave_1")
    public List<User> listAll() {
        List<User> list = this.lambdaQuery().list();
        return list;
    }

}
